<?php
/**
 * @version $Id: versions.php 1144 2010-03-29 13:38:58Z elkuku $
 * @package    EasyCreator
 * @subpackage Views
 * @author     EasyJoomla {@link http://www.easy-joomla.org Easy-Joomla.org}
 * @author     Nikolai Plath (elkuku) {@link http://www.nik-it.de NiK-IT.de}
 * @author     Created on 25-Sep-2008
 * @license    GNU/GPL, see JROOT/LICENSE.php
 */

// no direct access
defined( '_JEXEC' ) or die( ';)' );

echo '<h1>'.JText::_('Versions').'</h1>';

if( ! $this->sel_language )
{
	ecrHTML::displayMessage(JText::_('Please choose a language'));

	return;
}

if( ! count( $this->versions ))
{
	ecrHTML::displayMessage(JText::_('No versions found'), 'notice');

	return;
}

//--Add css
JHTML::stylesheet('diff.css', 'administrator/components/com_easycreator/assets/css/');

?>

<script type="text/javascript">
function showVersion(number)
{
	frm = document.adminForm;
	frm.selected_version.value = number;
	submitform('show_version');
}
</script>
<?php
if( $this->selected_version )
{
	$this->easyLanguage->displayVersion($this->selected_version, $this->sel_language);
}
?>
<table class="adminlist">
  <tr>
    <th><?php echo JText::_('Version'); ?></th>
    <th><?php echo JText::_('Size'); ?></th>
    <th><?php echo JText::_('Date'); ?></th>
    <th><?php echo JText::_('Actions'); ?></th>
  </tr>
  <?php
  $k = 0;
	foreach ($this->versions as $version)
	{
  	?>
  <tr class="row<?php echo $k; ?>">
    <td><?php echo $version->revNo; ?></td>
    <td><?php echo $version->size; ?></td>
    <td><?php echo $version->lastMod; ?></td>
    <td>
    <div class="ecr_button" onclick="showVersion('<?php echo $version->revNo; ?>');"><?php echo JText::_('Show'); ?></div>
    </td>
  </tr>
  <?php
  $k = 1 - $k;
	}//foreach
 ?>
</table>

<input type="hidden" name="selected_version" />
